ChatRemoteDataSource

@Singleton
class ChatRemoteDataSource @Inject constructor(fireStoreDatasource: FirebaseFirestore)

Data source for managing chat logs in Firestore. This class provides functions to add, delete, and retrieve chat logs from Firestore.

Constructors

Link copied to clipboard
@Inject
constructor(fireStoreDatasource: FirebaseFirestore)

Functions

Link copied to clipboard
suspend fun addLog(log: ChatLog)

Adds a chat log to Firestore. If the log does not have an ID, the operation is skipped.

suspend fun addLog(branch: ChatBranch, messageList: List<ChatMessage>)

Adds a new chat log to the Firestore database.

Link copied to clipboard
suspend fun deleteLog(log: ChatLog)

Deletes a chat log from Firestore. If the log does not have an ID, the operation is skipped.

suspend fun deleteLog(id: String)

Deletes a chat log from Firestore by its ID.

Link copied to clipboard
fun getChatLogs(): Flow<List<ChatLog>>

Retrieves chat logs from Firestore in real-time. This method listens for changes in the Firestore collection and emits updated logs.